import {ColumnsType} from "antd/lib/table";
import {User} from "../../types/user.ts";
import {Link} from "react-router-dom";

export const columns: ColumnsType<User> = [
    {
        title: '序号',
        dataIndex: 'id',
        align: 'center',
        rowScope: 'row'
    },
    {
        title: '用户名',
        dataIndex: 'username',
        align: 'center',
        key: 'username',
        render: (username, user) => <Link to={`${user.id}`}>{username}</Link>
    },
    {
        title: '性别',
        dataIndex: 'sex',
        align: 'center',
        key: 'sex',
        render: (sex) => <span>{sex == 1 ? '男' : '女'}</span>
    },
    {
        title: '年龄',
        dataIndex: 'age',
        align: 'center',
        key: 'age'
    },
    {
        title: '手机号码',
        dataIndex: 'phone',
        align: 'center',
        key: 'phone'
    },
    {
        title: '注册时间',
        dataIndex: 'createAt',
        align: 'center',
        key: 'createAt'
    },
]